using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ClientTools.Client.Controls.Packager.Dialogs
{
    public partial class AddDialog : Form
    {
        public AddDialog()
        {
            InitializeComponent();
        }

        private void OK_Button_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }

        private void Cancel_Button_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.Close();
        }

        private void AddDialog_Load(object sender, EventArgs e)
        {
            ClientTools.Client.Controls.GridViewHelper.SetGridLayout(this.dgv);
        }

        public Object DataSource
        {
            set { this.dgv.DataSource = value; }
        }

        public Object SelectedItem
        {
            get 
            {
                if (this.dgv.SelectedRows.Count != 1)
                {
                    return null;
                }
                else
                {
                    return this.dgv.SelectedRows[0].DataBoundItem;
                }
            }
        }
	
    }
}